package org.crazyit.activiti_d2._3_ListPage;

import org.activiti.engine.IdentityService;
import org.activiti.engine.ProcessEngine;
import org.activiti.engine.ProcessEngines;
import org.activiti.engine.identity.Group;

import java.util.List;

public class ListPage {

    public static void main(String[] args) {

        //1. 创建流程引擎
        ProcessEngine engine = ProcessEngines.getDefaultProcessEngine();

        //2. 得到身份服务组件实例
        IdentityService identityService = engine.getIdentityService();

        /*
            3. 调用listPage() 方法, 从索引为2的记录开始, 查询3条记录
            由于上一个类中已经写入了数据, 所以这边直接查询
         */
        List<Group> list = identityService.createGroupQuery().listPage(2, 3);

        //5. 遍历输出结果
        for (Group data : list) {
            System.out.println(data.getId() + "---" + data.getName() + " ");
        }

    }


}
